home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-27 | 88.3 KB | 2,402 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Sat, 27 Jan 96 Volume 3 : Issue 133
-
- Today's Topics:
-
- Checking for QuickTime
- Creating aliases
- Detecting <Option> + Double-Click
- Drag & Drop - Why is finder different?
- File I-O
- First OS for Quicktime?
- How to render DECENT 256 color sprites
- Launching Application on Remote Mac CPU
- MakeRGBPat Sucks (and how you can do better)
- MoveControl Doesn't Change Dialog Item Rect
- Newbie help with events....
- Oh where has my CODE 0 gone?
- The Required Apple Events (i.e. are they)
- Turning on Sharing
- [ANN] MoreFiles v1.4.1 now available
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet
- newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and
- csmp.games. It is designed for people who read news semi-regularly and
- want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, you
- may still be able to post messages to the group by using a mail server
- like anon.penet.fi (mail help@anon.penet.fi for more information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digest is officially distributed by two means, by email and ftp.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- The official ftp info is ftp://ftp.dartmouth.edu/pub/csmp-digest.
- Questions related to the ftp site should be directed to
- scott.silver@dartmouth.edu.
-
- -------------------------------------------------------
-
- >From geoffprice@aol.com (GeoffPrice)
- Subject: Checking for QuickTime
- Date: 4 Jan 1996 15:12:23 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- Can anyone let me know what the correct way to check for the presence of
- QuickTime is, and save me the experimental hassle?
-
- My old Think (PM v7) headers don't know about "gestaltQuickTimeVersion",
- so I'm passing 'qtim' to Gestalt as a literal. I understand this returns
- a version number; what's the format of this version number? (e.g.
- 0x0200?)
-
- What does it return if QT is not installed (0?)
-
- Thanks
- Geoff Price
- Intellimation / Caliban Mindwear
- GeoffPrice@aol.com
-
- +++++++++++++++++++++++++++
-
- >From rgaros@bio.vu.nl (Rene G.A. Ros)
- Date: 6 Jan 1996 19:54:19 +0100
- Organization: VU Biology, Amsterdam, The Netherlands
-
- GeoffPrice (geoffprice@aol.com) wrote:
- : Can anyone let me know what the correct way to check for the presence of
- : QuickTime is, and save me the experimental hassle?
-
- : My old Think (PM v7) headers don't know about "gestaltQuickTimeVersion",
- : so I'm passing 'qtim' to Gestalt as a literal. I understand this returns
- : a version number; what's the format of this version number? (e.g.
- : 0x0200?)
-
- **NumVersion**
- The format of the LongInt response can be coerced into type NumVersion,
- which is the same format as used for the 'vers' resource type.
-
- type
- NumVersion = packed record
- case INTEGER of
- 0: (majorRev: SignedByte; {1st part of version number in BCD}
- minorRev: 0..9; {2nd part is 1 nibble in BCD}
- bugFixRev: 0..9; {3rd part is 1 nibble in BCD}
- stage: SignedByte; {stage code: dev, alpha, beta, final}
- nonRelRev: SignedByte);{revision level of non-released version}
- 1: (version: LONGINT); {to use all 4 fields at one time}
- end;
-
- stage is one of: 0x20 = development
- 0x40 = alpha
- 0x60 = beta
- 0x80 = final
-
- : What does it return if QT is not installed (0?)
-
- Nothing, the selector isn't installed and you get an error back fromthe
- Gestalt call (gestaltUndefSelectorErr).
-
- Bye,
- Rene Ros
- Editor Gestalt Selectors List (use URL below to see it online)
-
- --
- Rene G.A. Ros rgaros@bio.vu.nl
- Amsterdam, The Netherlands http://www.bio.vu.nl/home/rgaros/
- - ------------------------------------------------------------------------------
- HAPPY NEW YEAR! GELUKKIG NIEUWJAAR!
-
- +++++++++++++++++++++++++++
-
- >From erichsen@pacificnet.net (Erichsen)
- Date: Sun, 07 Jan 1996 07:37:09 -0700
- Organization: Disorganized
-
- GeoffPrice (geoffprice@aol.com) wrote:
- > Can anyone let me know what the correct way to check for the presence of
- > QuickTime is, and save me the experimental hassle?
-
- Get DTS QuickTime Utilities. It's a bunch of utility routines by Apple DTS
- for QuickTime. It has a routine that checks if QuickTime is installed and
- gets its version, checks for QuickTime Musical Instruments, etc...They
- work correctly on a PowerPC too. It's on Apple's site.
-
- ---------------------------
-
- >From tomlinso@brigid.ucr.edu (John Tomlinson)
- Subject: Creating aliases
- Date: 4 Jan 1996 04:57:22 GMT
- Organization: University of California, Riverside
-
- I'm writing a program where I can drag from an application window to
- the Finder, and creating an alias if the drag succeeds. I've finally
- gotten it to the point where the drag doesn't bounce or cause the
- application to crash, but the "aliases" created are weirdly broken.
-
- Here's a code snippet to illustrate my method:
-
- (snip)
-
- NewDrag(&drag);
- itemRef = (ItemReference)myPort // "myPort" is a GrafPtr used by
- // my app
- promiseHFS.fileType = 'adrp';
- FSpGetFInfo(&fileSpec,&finderInfo); // "fileSpec" is a FSSpec variable
- // used by the app to store a link
- // to an application
- promiseHFS.fileCreator = finderInfo.fdCreator;
- promiseHFS.fdFlags = kIsAlias;
- promiseHFS.promisedFlavor = flavorTypeHFS;
- AddDragItemFlavor(drag,itemRef,flavorTypePromiseHFS,&promiseHFS,
- sizeof(PromiseHFSFlavor),0);
- AddDragItemFlavor(drag,itemRef,flavorTypeHFS,nil,0,0);
- SetDragSendProc(drag,SendDataProc,(void *)(&fileSpec));
-
- (rest of drag stuff snipped)
-
- And here is "SendDataProc":
-
- pascal OSErr SendDataProc(FlavorType type, void *dragSendRefCon,
- ItemReference itemRef, DragReference drag)
- {
-
- (snip)
-
- if (type == flavorTypeHFS)
- {
- dataSize = sizeof(PromiseHFSFlavor);
- GetFlavorData(drag,itemRef,flavorTypePromiseHFS,(Ptr)&promiseHFS,
- &dataSize,0);
- flavorHFS.fileType = promiseHFS.fileType;
- flavorHFS.fileCreator = promiseHFS.fileCreator;
- NewAlias(nil,(FSSpec *)dragSendRefCon,&alias)
- // also tried "NewAliasMinimal" here
- FindFolder(kOnSystemDisk,'temp',kCreateFolder,&vRefNum,&dirID);
- name = ConcatString(((FSSpec *)dragSendRefCon)->name,"\p alias");
- // "ConcatString" merely concatenates two Pascal strings and returns the
- // new string. Seems to work.
- FSMakeFSSpec(&fileSpec,flavorHFS.fileCreator,flavorHFS.fileType,
- smCurrentScript);
- HGetFInfo(vRefNum,dirID,name,&finderInfo);
- finderInfo.fdFlags = flavorHFS.fdFlags;
- HSetFInfo(vRefNum,dirID,name,&finderInfo);
- FSpCreateResFile(&fileSpec,flavorHFS.fileCreator,flavorHFS.fileType,
- smCurrentScript);
- FSpOpenResFile(&fileSpec,fsWrPerm);
- AddResource((Handle)alias,'alis',128,"\p");
- WriteResource((Handle)alias);
- flavorHFS.fileSpec = fileSpec;
- SetDragItemFlavorData(drag,itemRef,flavorTypeHFS,&flavorHFS,
- sizeof(HFSFlavor),0);
- FSpDelete(&fileSpec);
-
- (snip)
-
- This procedure creates a file which in some respects acts like an alias.
- It contains an 'alis' resource, it has the correct type and creator.
- When double-clicked, it launches the app, but not as an alias, I think--
- as a document of the app. Hence, if I create an "alias" to (say)
- DropStuff, I'll get a dialog box asking me if I want to save
- "DropStuff.sit" (i. e. if I want to compress my "alias".)
- The "alias" has a generic document icon, and when I check it with
- ResEdit, the "is Alias" bit is turned off (sometimes. Occasionaly
- I obtained "aliases" with the bit set. However, when I double-clicked
- these "aliases", I get a dialog box saying "this isn't really an
- alias (oops!)")
-
- Apparently the 'alis' resource is corrupt, but how?
-
- - John
-
- tomlinso@engr.ucr.edu
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 5 Jan 1996 11:27:44 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- John Tomlinson wrote:
- >I'm writing a program where I can drag from an application
- >window to the Finder, and creating an alias if the drag
- >succeeds. I've finally gotten it to the point where the drag
- >doesn't bounce or cause the application to crash, but the
- >"aliases" created are weirdly broken.
- > Here's a code snippet to illustrate my method:
- >
- >(snip)
-
- The problem in your code is that your don't set the isAlias Finder flag.
- That's what tells the system that the file is an alias file instead of a
- just a data file.
-
- Also, when creating the alias with NewAlias to put in an alias file, you
- should set the fromFile parameter to NewAlias to refer to the alias file
- itself. This will make your alias files more robust because when the
- Finder resolves an alias from an alias file, it uses an FSSpec to the
- alias file as the fromFile parameter passed to ResolveAlias.
-
- Actually, what I should be telling you here is you should send the Finder
- an AppleEvent to tell the Finder to create the alias file. Letting the
- Finder create the alias file is a much more compatible way to create alias
- files since you won't be depending on how the Finder creates alias files
- now.
-
- - Jim Luther
-
- +++++++++++++++++++++++++++
-
- >From Jeff Pritchard <jeffp@inow.com>
- Date: Fri, 05 Jan 1996 18:48:59 -0700
- Organization: NSI/INOW
-
- if you use the finder to make an alias of an application and then
- use resedit to get the file type of the alias file (use the open
- command and click on the "use alias instead of real file" checkbox)
- you will see that the finder does something different with aliases
- (aliiiiii?) of applications. Instead of copying the file type of
- the application (APPL), it uses 'adrp' for the file type.
-
- If you set your file type to adrp, I think you will find that the
- aliases you are creating will work fine. Mine do, and they are
- created in a manner functionally equivalent to your method.
-
- ---------------------------
-
- >From lyntaro@zoom.com (Totoro)
- Subject: Detecting <Option> + Double-Click
- Date: Wed, 03 Jan 1996 12:45:39 -0700
- Organization: Vega
-
- Is there any way I can detect a different mode of launching an
- application? For example, if a user launches an app while the user is
- pressing the <Option> key, how do I trap it?
-
- The reason is that my application might want to provide two execution
- mode, one is normal one with menus and windows, but in other mode I want
- the same app to do certain operations automatically.
-
- Thanks,
- Totoro
-
- +++++++++++++++++++++++++++
-
- >From pyared@idsinc.com (Pete Yared)
- Date: 4 Jan 1996 00:10:41 GMT
- Organization: Interactive Data Systems, Inc.
-
- In article <lyntaro-0301961245390001@lyntaro-slip.zoom.com>,
- lyntaro@zoom.com (Totoro) wrote:
-
- > Is there any way I can detect a different mode of launching an
- > application? For example, if a user launches an app while the user is
- > pressing the <Option> key, how do I trap it?
-
- Use the GetKeys trap to check to see if a command key is getting held down
- when your apps opens. This is consistent with the FInder since when you
- option drag to copy, the option key is checked when you finish the drag,
- not when it is started. However, option is a bad choice for what you're
- doing because the Finder uses option double-click to close the folder the
- document/app is in after a launch. I would recommend using command
- double-click instead.
-
- Pete Yared
- Interactive Data Systems, Inc.
- Washington, DC
- E-Mail: pyared@idsinc.com
- WWW: http://www.idsinc.com
- Anon FTP: ftp://ftp.idsinc.com
-
- +++++++++++++++++++++++++++
-
- >From eric.kidd@dartmouth.edu (Eric M. Kidd)
- Date: Fri, 05 Jan 1996 17:21:38 -0500
- Organization: Dartmouth College
-
- In article <lyntaro-0301961245390001@lyntaro-slip.zoom.com>,
- lyntaro@zoom.com (Totoro) wrote:
-
- > Is there any way I can detect a different mode of launching an
- > application? For example, if a user launches an app while the user is
- > pressing the <Option> key, how do I trap it?
-
- You can't easily detect which keys were down when the user double-clicked
- in the Finder, but you *can* check the keymap just as your application
- launches. The following as-yet-untested snippet should return a bitfield
- identical to the "modifiers" field of an EventRecord. Even if it doesn't
- work as advertised, it should point you in the right direction.
-
- //=========================================================================
- // • GetModifiers
- //=========================================================================
- // Return the current status of the modifier keys and mouse button, as
- // per the "modifiers" field in an EventRecord. We examine the virtual
- // keymap directly using low-level Event Manager calls, and call Button( )
- // to check the event queue for mouse-down events.
- //
- // See _Macintosh Toolbox Essentials_, p. 2-110, for documentation of
- // the function GetKeys and the data structure KeyMap.
-
- static unsigned short ModifierCodes[] = {
- // Mask Virtual Keycode
- cmdKey, 55,
- shiftKey, 56,
- shiftKey, 60, // right-hand side of keyboard
- alphaLock, 57,
- optionKey, 58,
- optionKey, 61, // "
- controlKey, 59,
- controlKey, 62, // "
- 0 };
-
- # define BITS_IN_LONG (32)
-
- unsigned short GetModifiers( )
- {
- KeyMap keyboardState;
- short index;
- short result;
-
- // Read the virtual keyboard map
- GetKeys( keyboardState );
-
- // Build our result. We walk our array of mask/keycode
- // pairs until we find a mask equal to zero.
- result = 0;
- for ( index = 0; ModifierCodes[index] != 0; index += 2 )
- {
- unsigned short currentMask, currentCode;
- unsigned short whichLong, whichBit;
-
- // Fetch our current entry
- currentMask = ModifierCodes[index];
- currentCode = ModifierCodes[index+1];
-
- // Translate virtual keycode to map offset.
- whichLong = (currentCode-1) / BITS_IN_LONG;
- whichBit = (currentCode-1) % BITS_IN_LONG;
-
- if ( keyboardState[whichLong] & (1 << whichBit) )
- result |= currentMask;
- }
-
- // Check the mouse button. This actually looks
- // in the event queue for a mouse-down event;
- // it doesn't check the current mouse status.
- if ( Button( ) )
- result |= btnState;
-
- return result;
- }
-
-
- > The reason is that my application might want to provide two execution
- > mode, one is normal one with menus and windows, but in other mode I want
- > the same app to do certain operations automatically.
-
- Typically, the second mode would be the "option". Also be sure to check
- that you are in the foreground before looking for the option key--you
- should ignore it if your application has somehow been launched as a
- background process via Apple Events. I use the following code:
-
- if ( IsCurrentProcessForeground( ) )
- gModifiersHeldDownAtLaunch = GetModifiers( );
- else
- gModifiersHeldDownAtLaunch = 0; // no modifiers
-
- The function IsCurrentProcessForeground is defined as:
-
- //==========================================================================
- // IsCurrentProcessForeground
- //==========================================================================
- // Returns true if the current process is also the foreground process, from
- // the user's perspective. If an error occurs, assume it isn't.
-
- Boolean IsCurrentProcessForeground( )
- {
- ProcessSerialNumber current;
- ProcessSerialNumber front;
- Boolean result;
- OSErr err = noErr;
-
- RETURN_ON_ERR( GetCurrentProcess( ¤t ) );
- RETURN_ON_ERR( GetFrontProcess( &front ) );
- RETURN_ON_ERR( SameProcess( ¤t, &front, &result ) );
-
- clean_up:
- return (err == noErr) ? result : false;
- }
-
- Good luck and have fun!
-
- Cheers,
- Eric
-
- ........................................................................
- Eric Kidd (eric.kidd@dartmouth.edu) http://coos.dartmouth.edu/~emk/
- "Computers are useless. They can only give you answers." -Pablo Picasso
-
- ---------------------------
-
- >From kerr@math.ohio-state.edu (Kerr Gibson)
- Subject: Drag & Drop - Why is finder different?
- Date: 29 Dec 1995 12:01:19 -0500
- Organization: Department of Mathematics, The Ohio State University
-
-
- Hi all,
-
- Recently I was discussing with a co-worker how to extend some of our drag and
- drop capabilities for our product. In doing so we noticed that the finder
- behaves differently than other products when dragging from it.
-
- The finder remains in the background when dragging out of it to other
- applications, however, any other program we look at activates first before
- allowing the drag. This is an extremely irritating anomoly. The user expects
- to select something in program A- go to program B and then drag the selection
- from program A to a window in Program B. But as soon as the user mouse downs in
- program A- program A activates and (in many if not most instances) covers up
- the destination area of program B. Not only this, but program A will not have
- drawn any of its content either so it is doubly irritating.
-
- How is it then that the finder is able to remain in the background during a
- mouse down? We have looked all over the documentation for any indication of
- how to impliment this in our app but cannot find the subject addressed. The
- nearest thing we found was in the drag&drop human interface guidelines and it
- said the following:
-
- 'Historically, an inactive window becomes active upon a mouse-down event in
- that window. Since the user may drag an item from an inactive window to the
- frontmost window, and continue working in the frontmost window, this behavior
- must be slightly modified so that, in a certain case described below, the
- mouse-up event serves as the window-activation trigger, rather than the
- mouse-down event.'
-
- But this only seems to be talking about windows in the same app- not different
- windows in different apps. I can only assume that the finder code is cheating
- somehow.
-
- Anyway, are we missing something obvious here or is this something that cannot
- be done? I should mention also that sticky notes has this same problem, but
- the scrapbook does not.
-
- --
- Kerr Gibson
- - -------
- Someday I'm gonna make a signature file...
-
-
-
-
-
-
- --
- Kerr Gibson |
- kerr@math.ohio-state.edu | Someday I'm gonna make a .signature file...
-
- +++++++++++++++++++++++++++
-
- >From kenp@nmrfam.wisc.edu (Ken Prehoda)
- Date: Fri, 29 Dec 1995 14:32:07 -0600
- Organization: Univ of Wisconsin-Madison, Dept of Biochemistry
-
- In article <4c16sv$p2q@math.mps.ohio-state.edu>, kerr@math.ohio-state.edu
- (Kerr Gibson) wrote:
-
- : Hi all,
- :
- : Recently I was discussing with a co-worker how to extend some of our drag and
- : drop capabilities for our product. In doing so we noticed that the finder
- : behaves differently than other products when dragging from it.
- :
- : The finder remains in the background when dragging out of it to other
- : applications, however, any other program we look at activates first before
- : allowing the drag. This is an extremely irritating anomoly. The user expects
- : to select something in program A- go to program B and then drag the selection
- : from program A to a window in Program B. But as soon as the user mouse
- downs in
- : program A- program A activates and (in many if not most instances) covers up
- : the destination area of program B. Not only this, but program A will not have
- : drawn any of its content either so it is doubly irritating.
- :
- : How is it then that the finder is able to remain in the background during a
- : mouse down? We have looked all over the documentation for any indication of
- : how to impliment this in our app but cannot find the subject addressed. The
- : nearest thing we found was in the drag&drop human interface guidelines and it
- : said the following:
-
-
- The finder registers a callback with the drag manager. This stuff is
- undocumented because the drag manager engineers felt that it was a really
- skanky addition to the macintosh hackitecture.
-
- Atleast that's the story I got when I asked about the undocumented callback.
- _____________________________________________________________________________
- Ken Prehoda kenp@nmrfam.wisc.edu
- Department of Biochemistry http://www.nmrfam.wisc.edu
- University of Wisconsin-Madison Tel: 608-263-9498
- 420 Henry Mall Fax: 608-262-3453
-
- +++++++++++++++++++++++++++
-
- >From erichsen@pacificnet.net (Erichsen)
- Date: 30 Dec 1995 02:13:20 GMT
- Organization: Disorganized
-
- In article <4c16sv$p2q@math.mps.ohio-state.edu>, kerr@math.ohio-state.edu
- (Kerr Gibson) wrote:
-
- >The finder remains in the background when dragging out of it to other
- >applications, however, any other program we look at activates first before
- >allowing the drag. This is an extremely irritating anomoly. The user expects
- >to select something in program A- go to program B and then drag the selection
- >from program A to a window in Program B. But as soon as the user mouse downs in
- >program A- program A activates and (in many if not most instances) covers up
- >the destination area of program B. Not only this, but program A will not have
- >drawn any of its content either so it is doubly irritating.
-
- The Finder uses an undocumented callback that lets you decide whether to
- activate your app or not. Check out the source for WASTE, in the demo he
- shows how to do it.
-
- +++++++++++++++++++++++++++
-
- >From Kerr Gibson <kerr@math.ohio-state.edu>
- Date: Thu, 04 Jan 1996 11:21:30 -0500
- Organization: The Ohio State University, Department of Mathematics
-
- Erichsen wrote:
- >
- > The Finder uses an undocumented callback that lets you decide whether to
- > activate your app or not. Check out the source for WASTE, in the demo he
- > shows how to do it.
-
- Well I got WASTE 1.2a4 and compiled the demo in the Symantec Project
- Manager. The demo had the same problem as everyone else. I made a
- window and selected text and then activated the finder. Then I
- attempted to drag the text out of the deactivated demo. All that
- happened was that the demo activated and the text did not even drag
- at all. I looked through the code for this callback but could not
- seem to locate it. Perhaps there is some kind of switch in the demo
- I have to turn on? I'm not doubting your word, maybe I am just
- missing something.
-
- --
- Kerr Gibson
- - -------
- Someday I'm gonna make a signature file...
-
- +++++++++++++++++++++++++++
-
- >From erichsen@pacificnet.net (Erichsen)
- Date: Fri, 05 Jan 1996 14:36:27 -0700
- Organization: Disorganized
-
- In article <30EBFE8A.D0D@math.ohio-state.edu>, Kerr Gibson
- <kerr@math.ohio-state.edu> wrote:
-
- >Well I got WASTE 1.2a4 and compiled the demo in the Symantec Project
- >Manager. The demo had the same problem as everyone else. I made a
- >window and selected text and then activated the finder. Then I
- >attempted to drag the text out of the deactivated demo. All that
- >happened was that the demo activated and the text did not even drag
- >at all. I looked through the code for this callback but could not
- >seem to locate it. Perhaps there is some kind of switch in the demo
- >I have to turn on? I'm not doubting your word, maybe I am just
- >missing something.
-
- Sorry, it looks like they've removed it from 1.2a4. Here's the file from
- an older demo of WASTE that shows how to do it. I've attached it here.
- It's in Pascal but, easy to convert to C or something else.
-
-
- +++++++++++++++++++++++++++
-
- >From Kerr Gibson <kerr@math.ohio-state.edu>
- Date: Thu, 04 Jan 1996 18:24:37 -0500
- Organization: The Ohio State University, Department of Mathematics
-
- Erichsen wrote:
- >
- > Sorry, it looks like they've removed it from 1.2a4. Here's the file from
- > an older demo of WASTE that shows how to do it. I've attached it here.
- > It's in Pascal but, easy to convert to C or something else.
- >
-
- Thanks a lot- I will look into it.
-
- --
- Kerr Gibson
- - -------
- WARNING: People are attempting to extract personal information from
- you via the internet in order to exploit you. They cleverly conceal
- their attempts with contests or surveys or 'free' trinkets. Don't
- be fooled. Don't give out personal information unless absolutely
- nessesary and then give as little as possible. Don't trade your
- personhood for trinkets.
-
- +++++++++++++++++++++++++++
-
- >From Kerr Gibson <kerr@math.ohio-state.edu>
- Date: Tue, 09 Jan 1996 15:40:39 -0500
- Organization: The Ohio State University, Department of Mathematics
-
- Kerr Gibson wrote:
- >
- > Erichsen wrote:
- > >
- > > Sorry, it looks like they've removed it from 1.2a4. Here's the file from
- > > an older demo of WASTE that shows how to do it. I've attached it here.
- > > It's in Pascal but, easy to convert to C or something else.
- > >
- >
- > Thanks a lot- I will look into it.
-
-
- OK, that worked out great.
-
- If anyone is interested, we hacked together this system callback in
- Symantec C++. We even got it to work for the Power PC. So if
- somebody wants this in WASTE or any other code, we are willing to
- give it out. Otherwise I guess we will just keep it to ourselves.
-
- --
- Kerr Gibson
- - -------
- WARNING: People are attempting to extract personal information from
- you via the internet in order to exploit you. They cleverly conceal
- their attempts with contests or surveys or 'free' trinkets. Don't
- be fooled. Don't give out personal information unless absolutely
- nessesary and then give as little as possible. Don't trade your
- personhood for trinkets.
-
- ---------------------------
-
- >From vanderz@ERC.MsState.Edu (John VanderZwaag)
- Subject: File I-O
- Date: 10 Jan 1996 01:47:45 GMT
- Organization: Mississippi State University
-
- I'm coming from a Unix environment - how do Mac programmers do file i/o? Do you
- actually use FSWrite/FSRead? This seems more difficult than FILE stream. Are there
- comparable Mac functions? I want to use actual Mac calls and not resort to
- cheating as it seems to have been deemed sinful to do in the Real World.
-
- Any help would be more than greatly appreciated.
-
- --
- john vander zwaag
- jrv1@ra.msstate.edu
- vanderz@erc.msstate.edu
- http://www.sarc.msstate.edu/Homepages/john
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 10 Jan 1996 02:15:17 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- John VanderZwaag wrote:
- >I'm coming from a Unix environment - how do Mac programmers do
- >file i/o? Do you actually use FSWrite/FSRead? This seems more
- >difficult than FILE stream. Are there comparable Mac functions?
- > I want to use actual Mac calls and not resort to cheating as
- >it seems to have been deemed sinful to do in the Real World.
- >
- >Any help would be more than greatly appreciated.
-
- I actually use FSRead and FSWrite (when I'm not using PBRead and PBWrite),
- but then, I'm probably more comfortable with the File Manager than most
- after supporting it for several years.
-
- Many other programmers use a standard I/O library, or a streams library
- (like TCL or PowerPlant provide) built on top of the File Manager and are
- happy with that.
-
- The biggest advantage you get using the File Manager directly is closer
- control at a lower level. For example, with PBRead, you can set a bit that
- tells the file system to not cache I/O if possible - something you
- probably have no control over when you use a library. The advantages of
- using standard I/O libraries that come with your development environment
- are: 1) you're probably familiar with it and 2) it probably provides you
- with buffered I/O.
-
- If you decide to use the File Manager routines, you might also want to
- look at the sample code/library MoreFiles. It shows how to do lots of
- common File Manager related things that are Macintosh specific. For
- example, getting a list of file in a specific directory. You can get the
- latest version of MoreFiles at:
-
- ftp://members.aol.com/JumpLong/MoreFiles_1.4.1.sea.hqx
-
- Have fun,
- Jim Luther
-
- +++++++++++++++++++++++++++
-
- >From sample@esltd.com (Don Sample)
- Date: Wed, 10 Jan 1996 17:15:09 -0500
- Organization: Enerprise Solutions Ltd
-
- In article <4cv5s1$nqd@NNTP.MsState.Edu>, vanderz@ERC.MsState.Edu (John
- VanderZwaag) wrote:
-
- >I'm coming from a Unix environment - how do Mac programmers do file i/o?
- Do you
- >actually use FSWrite/FSRead? This seems more difficult than FILE
- stream. Are there
- >comparable Mac functions? I want to use actual Mac calls and not resort to
- >cheating as it seems to have been deemed sinful to do in the Real World.
- >
- >Any help would be more than greatly appreciated.
- >
- >--
-
- If you really want to use them, every Mac C programming environment which
- I am aware of provides an ANSI standard library with the various FILE
- stream function calls.
-
- But using the Mac FSpXxxx and FSXxxxx function calls aren't really any
- more difficult than the ANSI fxxxxx calls, Especially if you start trying
- to open files in multiple directories.
-
- --
- Don Sample (sample@esltd.com) | Quando Omni Flunkus
- Enterprise Solutions Ltd. | Moritati
- http://www.esltd.com/esl_people/sample/ |
-
- +++++++++++++++++++++++++++
-
- >From garyg@jax.jaxnet.com (Gary M. Greenberg)
- Date: Thu, 11 Jan 1996 19:49:32 -0500
- Organization: Southeast Network Services, Inc.
-
- In article <4cv5s1$nqd@NNTP.MsState.Edu>, vanderz@ERC.MsState.Edu (John
- VanderZwaag) wrote:
-
- > I'm coming from a Unix environment - how do Mac programmers do file
- i/o? Do you
- > actually use FSWrite/FSRead? This seems more difficult than FILE
- stream. Are there
- > comparable Mac functions? I want to use actual Mac calls and not resort to
- > cheating as it seems to have been deemed sinful to do in the Real World.
- >
- You've been told, but I use FILE and fopen(), fclose(), et al.
-
- I've mostly had to be ANSI C compatible and the Mac handles it just fine.
- Portablility has been my issue ...
-
- Lo, I await the day when I become a Toolbox power-user ;-)
-
- ciao4now,
-
- gary /* the Sorcerer's Apprentice */
-
- "Why do we have to hide from the police, Daddy?" | Truth:
- "Because we use vi, honey. They use emacs." | This .sig is pirated
-
-
- ---------------------------
-
- >From McMath_C@mediasoft.net (Chuck E's In Love... McMath)
- Subject: First OS for Quicktime?
- Date: Thu, 11 Jan 1996 17:16:50 -0500
- Organization: Reed Technology & Information Services, Inc.
-
- I've got an easy question: at what OS revision did QuickTime first appear,
- and what is the first OS where it gets installed as part of the OS
- itself? I thought it was part of 7.0, but other people don't agree, and I
- can't find any written confirmation of when it was packed into the system.
-
- Thanks in advance,
-
- chuck
-
- |-- Chuck McMath -- McMath_C@mediasoft.net -or-- chuck@ocs.com -----|
- |-- Reed Technology & Information Services, Inc. -------------------|
- |-- 20251 Century Blvd. -- Germantown, MD 20874 -------------------|
- |-------------- "Hey Batter, Hey Batter, swing!" - Anon.------------|
- |--------------- My Karma Ran Over My Dogma ------------------------|
-
-
- +++++++++++++++++++++++++++
-
- >From jayfar@netaxs.com (Jay Farrell)
- Date: Fri, 12 Jan 1996 20:51:58 -0500
- Organization: Jayfar's Web
-
- In article <McMath_C-1101961716500001@ras112.mediasoft.net>,
- McMath_C@mediasoft.net (Chuck E's In Love... McMath) wrote:
-
- | I've got an easy question: at what OS revision did QuickTime first appear,
- | and what is the first OS where it gets installed as part of the OS
- | itself? I thought it was part of 7.0, but other people don't agree, and I
- | can't find any written confirmation of when it was packed into the system.
-
- It isn't part of the System yet, if you mean in the sense of it being in
- the System file. It is an extension, or several extensions if you need
- Quicktime Musical Instruments or QuickTime PowerPlug (PPC).
-
- Just as well, I save some ram by not loading it when I don't intend to use it.
-
- Cheers,
- Jayfar
-
- ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~////
- //// The Mops Page <URL:http://www.netaxs.com/~jayfar/mops.html> ////
- ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~////
- //// Mops is Mike Hore's freeware Forth/Smalltalk hybrid for Macintosh ////
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Jay Farrell jayfar@netaxs.com Philadelphia, Pennsylvania, USA
-
- +++++++++++++++++++++++++++
-
- >From ckt@best.com (Chris Thomas)
- Date: Fri, 12 Jan 1996 19:12:49 -0800
- Organization: Echo Software
-
- In article <McMath_C-1101961716500001@ras112.mediasoft.net>,
- McMath_C@mediasoft.net (Chuck E's In Love... McMath) wrote:
-
- > I've got an easy question: at what OS revision did QuickTime first appear,
- > and what is the first OS where it gets installed as part of the OS
- > itself? I thought it was part of 7.0, but other people don't agree, and I
- > can't find any written confirmation of when it was packed into the system.
-
- It works (or used to work) with 6.0.7. I think it was released between
- 7.0 and 7.1. It's still not packed into the System. It is installed by
- the 7.5 installer, and I think it was first installed by installers for
- some of the 7.1 variants (7.1.1, 7.1.2).
-
- --
- Chris Thomas, ckt@best.com
-
-
- ---------------------------
-
- >From vcan@bbn.com (V)
- Subject: How to render DECENT 256 color sprites
- Date: Wed, 03 Jan 1996 11:52:31 -0500
- Organization: BBN
-
-
- Can I ask what software y'all are using to render your sprites?
- I have seen numerous games out there with REALLY nice sprites
- when only using 256 colors.
-
- I'm writing yet another Ultima type clone and I need graphics!!
- I've been trying to draw shapes and such in thousands and try
- to convert them down to 256 with horrible results.
-
- I have access to photoshop and infini-D (both at work).
-
- Should I buy a texture-making plug-in?
-
- I can't afford to pay someone to do my graphics..
- How can I find someone on the net who can create some for me
- in exchange for partial income from the game when it ships?
- (shareware really).
-
- Also, is there a cheap 3-d rendering package that will give me
- decent results with 256 colors?
-
- -V-
-
- --
- Opinions expressed are probably my own.
-
- +++++++++++++++++++++++++++
-
- >From jregier@qualcomm.com (Jason Regier)
- Date: Wed, 03 Jan 1996 10:29:10 -0800
- Organization: Qualcomm, Inc.
-
- In article <vcan-0301961152310001@vcan.bbn.com>, vcan@bbn.com (V) wrote:
- > I'm writing yet another Ultima type clone and I need graphics!!
- > I've been trying to draw shapes and such in thousands and try
- > to convert them down to 256 with horrible results.
- >
- For AmoebArena, almost all of the artwork was rendered on a PC in 24-bit
- color and the result was converted to 256 colors to conserve memory.
- Even though it's in the 8-bit system palette, we've gotten lots of
- compliments about the artwork.
-
- How did we do it? Well, for starters, see if your 3D program will render
- to a specified palette or bit depth. I think Infini-D does allow this.
- Rendering your graphics directly to 256 colors will probably look better
- than rendering in 24-bit and dithering down to 8-bit.
-
- Although I didn't completely like the way Photoshop dithered graphics down
- to 8-bit color (I found lots of white pixels scattered all over in some
- cases) we took the images in RGB format, and converted them to Indexed
- Color. For our case, we used System Palette - Diffusion. There's a lot
- of different colors in AmoebArena, and for simplicity (and so things
- looked good) we chose to work within the system palette rather than use a
- custom palette. If you'd rather use a custom palette, I'm almost certain
- Photoshop will generate one for you. If I'm not mistaken, go to Indexed
- color, select Exact, and Photoshop will choose exactly which colors you
- picture needs and stores them in a clut when saving your PICT. You can
- copy the clut and the PICT resource over to your game's resource file, and
- access them both to bring your beauty to the screen.
-
- Well, I hope you haven't tried the above with no success. If things STILL
- don't look good, there most likely isn't much you can do except take your
- 8-bit sprites and go over them by hand and touch them up so they look
- right.
-
- Good luck!
- Jason
-
- --
- Jason Regier
- GlobalStar Software Engineer
- QUALCOMM, Inc.
- (619) 658-4752
- jregier@qualcomm.com
-
- +++++++++++++++++++++++++++
-
- >From rmckay@chat.carleton.ca (Reevan McKay)
- Date: Mon, 8 Jan 1996 06:13:59 GMT
- Organization: Carleton University
-
- Jason Regier (jregier@qualcomm.com) wrote:
-
- > Rendering your graphics directly to 256 colors will probably look better
- > than rendering in 24-bit and dithering down to 8-bit.
-
- True, although another thing to consider is to avoid dithering
- your sprites when you map them to 8 bits. Dithering tends to look very
- silly unless it is done carefully. If you are using photoshop, try using
- the "None" option under "Dithering": the color match won't be quite as
- exact, but your customers will never know the difference... and they won't
- see (shudder) horrible dithering.
-
- A note on PShop palettes... They are NOT stored as CLUTs (at
- least not in v 2.51). They are pure data files, 768 bytes long, I
- believe. There are always 256 entries, though spare (unused) entries
- contain the color black. Each entry is three bytes, each representing a
- value from 0-255 for Red, Green and Blue respectively. I think I've got a
- code chunk sitting around which reads a PShop palette and converts it to a
- color table for your application's use. If you can't get it work on your
- own, let me know and I'll see what I can dig up (HINT: Get _Inside_Macintosh:_
- Files_ if you haven't already).
-
- > (take your)
- > 8-bit sprites and go over them by hand and touch them up so they look
- > right.
-
- This is almost an inevitability anyways.
-
- > Good luck!
- > Jason
- Ditto
-
- - --------------------------------------------------------------------
- Mikado
- Second Year Architecture
- Carleton University
-
- "Jesus was an architect, previous to his career as a prophet."
-
- Email address: rmckay@chat.carleton.ca
- - --------------------------------------------------------------------
-
- ---------------------------
-
- >From Richard Gaitskell <gaitskell@physics.berkeley.edu>
- Subject: Launching Application on Remote Mac CPU
- Date: 3 Jan 1996 01:51:02 GMT
- Organization: Center for Particle Astrophysics, Berkeley
-
- Is there a way to launch a new application on a remote Macintosh's CPU
- assuming you can connect to the Mac via an AppleTalk/Ethernet network
- and have the appropriate access privileges ?
-
- I believe the commercial package "Timbuktu" permits you to take over a
- remote machine. However, is there a way to simply launch an application
- by sending an instruction to the remote mac's Finder using AppleScript ?
-
-
- Rick Gaitskell
- Center for Particle Astrophysics
- UC Berkeley, CA
-
- gaitskell@physics.berkeley.edu
-
-
-
- +++++++++++++++++++++++++++
-
- >From zobkiw@triplesoft.com (Joe Zobkiw)
- Date: Wed, 03 Jan 1996 19:55:08 -0500
- Organization: TripleSoft Inc.
-
- In article <4ccne6$mtr@agate.berkeley.edu>, Richard Gaitskell
- <gaitskell@physics.berkeley.edu> wrote:
-
- >Is there a way to launch a new application on a remote Macintosh's CPU
- >assuming you can connect to the Mac via an AppleTalk/Ethernet network
- >and have the appropriate access privileges ?
- >
- >I believe the commercial package "Timbuktu" permits you to take over a
- >remote machine. However, is there a way to simply launch an application
- >by sending an instruction to the remote mac's Finder using AppleScript ?
-
- Make sure Program Linking is enabled on the receiving machine and send an
- AppleEvent to the Finder on that machine. Assuming you know the location
- of the file, you can launch it quite easily. Another way is to write a
- small "server" application that uses the PPC Toolbox. This runs on the
- remote machine and gives you access to the specific files you need.
- Depending on your needs, the PPC Toolbox/AppleEvents is probably a good
- way to go.
-
- Joe Zobkiw <mailto:zobkiw@triplesoft.com>
- TripleSoft Inc. <http://www.triplesoft.com/>
- Specializing in Custom Macintosh Software Development & Solutions
- - ---------------------------------------------------------------
- Macintosh programmers! Check out "A Fragment of Your Imagination"
- from Addison-Wesley <http://www.triplesoft.com/fragment/>
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 12 Jan 1996 05:37:48 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- Richard Gaitskell wrote:
- >Is there a way to launch a new application on a remote
- >Macintosh's CPU assuming you can connect to the Mac via an
- >AppleTalk/Ethernet network and have the appropriate access
- >privileges ?
- >
- >I believe the commercial package "Timbuktu" permits you to take
- >over a remote machine. However, is there a way to simply launch
- >an application by sending an instruction to the remote mac's
- >Finder using AppleScript ?
-
- If you have program linking turned ON on the remote system, you can use
- this AppleScript:
-
- tell application "Finder" of machine "RemoteMac" of zone "Zone"
- open file "volume:directory:myApp"
- end tell
-
- - Jim Luther
-
- +++++++++++++++++++++++++++
-
- >From ck@be.com (C.K. Haun)
- Date: Fri, 12 Jan 1996 10:22:36 -0800
- Organization: Be, Inc.
-
- > >Is there a way to launch a new application on a remote
- > >Macintosh's CPU assuming you can connect to the Mac via an
- > >AppleTalk/Ethernet network and have the appropriate access
- > >privileges ?
- > If you have program linking turned ON on the remote system, you can use
- > this AppleScript:
- > tell application "Finder" of machine "RemoteMac" of zone "Zone"
- > open file "volume:directory:myApp"
- > end tell
-
- You can also send the same event directly by sending a OpenSelection event
- to the remote Finder (that's what APpelScript is doing in this case).
- Note a few things;
- 1) You must supply the *full path* to the item. You can't use a relative
- path and can't use a file alias
- 2) If you get it wrong, the remote Mac will display a really weird and
- unusual error dialog to the user on the remote Mac, which could be
- confusing. Or as Jim will confirm, sometimes amusing.
- 3) There is no confirmation that this actually worked. You will have to
- wait an appropriate period of time and try and find the newly lanched
- application yourself through the PPC browser or IPCListPorts.
- 4) The sample "FinderOpenSel 2.x" has code to do this in it.
- C.K. Haun
- The Developer Guy @ Be, Inc.
-
- --
- C.K. Haun
- ck@be.com
- The Mild Bunch
- 1996 Royal Star 1300 1991 Voyager 1200 1990 Virago 750
- 1993 Virago 535 1987 Reflex 225
-
-
- ---------------------------
-
- >From jmunkki@beta.hut.fi (Juri Munkki)
- Subject: MakeRGBPat Sucks (and how you can do better)
- Date: 31 Dec 1995 10:03:03 GMT
- Organization: Helsinki University of Technology
-
- A game I'm writing really shines in thousands and millions of colors because
- it has access to all the colors it needs. In 256 colors, some colors didn't
- look all that good.
-
- The Apple System palette has a map of 6x6x6 colors (216 colors) plus some
- gray shades and shades of pure red/green/blue that are not in the 6x6x6
- map.
-
- My first idea was to use a custom palette for some of the more critical
- colors. The problem is that I wasn't sure which colors I should give up
- from the default 256 for these colors. All in all, it seemed like a messy
- solution.
-
- In 4 and 16 colors I have always used MakeRGBPat and used the resulting
- patterns instead of solid colors.
-
- So, I examined my drawing code and found that doing a patterned fill in
- 8 bit mode wasn't any more expensive than the solid fill.
-
- The next step was to use MakeRGBPat to make 2x2 patterns from the 256
- color palette.
-
- That's where I ran into problems. The patterns draw just fine and in
- some cases they looked ok. In many cases, the patterns would look really
- bad. MakeRGBPat uses up to four colors, but usually it only uses two and
- it tries to balance them so that they average to the requested color. In
- many cases it just does a very bad job and gives me an almost white when
- I requested something quite different. Using only the top two colors
- helped a bit for some reason, so I started suspecting that MakeRGBPat
- wasn't doing it right.
- So, the next approach was to roll my own RGBPat. I decided to keep it
- simple and only use two colors in a patter like this:
-
- A B
- B A
-
- A pattern like this is very hard to detect on most monitors. I have to
- look really closely on my 16" Apple RGB monitor to see the patterns if
- A and B are close in color.
-
- The first step is to use Color2Index to request color A. This is the main
- color of the pattern and should be closest thing that can be found to the
- color we want.
-
- Then, we find out what this index really maps to by calling Index2Color.
- This enables us to calculate the different between A and the color we
- really needed (call it N). I use a simple distance estimator function
- to get the distance in RGB space.
-
- If the distance is 0, we have an exact match and the pattern can be
- a solid where B = A.
-
- Next, we have to figure out what a good B would be. The ideal case would
- be that the average of A and B would be N. So if (A+B)/2 = N, then we
- get that B = 2N - A. We use Color2Index to find the closest color to B.
- We convert this index back to RGB and calculate (A+B)/2. This is the
- color we get when we mix A and B on the screen. If the distance between
- N and (A+B)/2 is smaller than the distance between N and A, we use the
- color B in the pattern, otherwise we use a solid A pattern.
-
- Now I wasn't sure how this would work. I felt a bit stupid writing
- something as simple as this, when Apple in its wisdom provided a
- function that _should_ do better.
-
- To my surprise, my algorithm produces extremely pleasing results. If I
- look at the screen from a typical viewing distance, it's hard to tell
- the difference between 256 and millions of colors (in my application).
-
- There are none of the awful artifacts that I got with MakeRGBPat. I
- find it hard to believe that MakeRGBPat would even be any faster,
- because the only expensive calls that I make are the two calls to
- Color2Index.
-
- --
- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap.
- http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind.
-
- +++++++++++++++++++++++++++
-
- >From Matt Slot <fprefect@umich.edu>
- Date: 31 Dec 1995 18:42:24 GMT
- Organization: University of Michigan
-
- Juri Munkki, jmunkki@beta.hut.fi writes:
- > So, the next approach was to roll my own RGBPat.
-
- Your description of the technique is excellent, but is there
- any chance you could post the corresponding code you've written
- for your "BetterRGBPat()" function?
-
- Matt
-
- * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
- * Reality: Matt Slot * Time is an illusion.
- * E-Mail: mailto:fprefect@umich.edu * Lunchtime doubly so.
- * Web: http://www.sils.umich.edu/~fprefect/ * -- Douglas Adams
- * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
-
- +++++++++++++++++++++++++++
-
- >From jmunkki@beta.hut.fi (Juri Munkki)
- Date: 1 Jan 1996 05:49:08 GMT
- Organization: Helsinki University of Technology
-
- In article <4c6lig$b3f@srvr1.engin.umich.edu> Matt Slot <fprefect@umich.edu> writes:
- >Juri Munkki, jmunkki@beta.hut.fi writes:
- > > So, the next approach was to roll my own RGBPat.
- >
- >Your description of the technique is excellent, but is there
- >any chance you could post the corresponding code you've written
- >for your "BetterRGBPat()" function?
-
- The problem is that I do all my own rendering (Quickdraw is used to
- manage colors and graphics devices and that's it), so when I removed
- the call to MakeRGBPat, I also changed my code so that it directly
- writes into my own structures (for 8 bit devices a 4 x 2 pixels).
-
- So, the function only covers 8 bit pixmaps and doesn't create a real
- pixel pattern.
-
- Since you asked so kindly, here it is. Don't expect it to compile,
- because the distance estimator is not there (you can use the sum
- of squares, if you want really accurate results, but watch the
- number ranges for overflows).
-
- It's also just my first draft at the algorithm.
-
- void Build8BitColorMap(
- PolyDevice **aPolyDevice,
- PolyColorTable *aColorTable)
- {
- GDHandle savedGD;
- GrafPtr saved;
- RGBColor tempColor;
- long colorA;
- short i;
- char *dest;
- Handle destTable;
-
- GetPort(&saved);
- savedGD = GetGDevice();
-
- SetGDevice((*aPolyDevice)->itsDevice);
-
- destTable = (*aPolyDevice)->colorMap;
- SetHandleSize(destTable,aColorTable->polyColorCount * 8L);
- HLock(destTable);
-
- dest = *destTable;
-
- for(i=0;i<aColorTable->polyColorCount;i++)
- { RGBColor friendColor;
- long colorB;
- long redDelta, greenDelta, blueDelta;
- long oneErr, twoErr;
-
- colorA = (*aColorTable->colorEntryHandle)[i].color;
-
- tempColor.red = ((unsigned char *)&colorA)[1];
- tempColor.green = ((unsigned char *)&colorA)[2];
- tempColor.blue = ((unsigned char *)&colorA)[3];
-
- tempColor.red += tempColor.red << 8;
- tempColor.green += tempColor.green << 8;
- tempColor.blue += tempColor.blue << 8;
-
- colorA = Color2Index(&tempColor);
- Index2Color(colorA, &friendColor);
-
- redDelta = friendColor.red - (long)tempColor.red;
- greenDelta = friendColor.green - (long)tempColor.green;
- blueDelta = friendColor.blue - (long)tempColor.blue;
-
- oneErr = FDistanceOverEstimate(redDelta, greenDelta, blueDelta);
-
- if(oneErr)
- { redDelta = tempColor.red - redDelta;
- greenDelta = tempColor.green - greenDelta;
- blueDelta = tempColor.blue - blueDelta;
-
- #define BOUNDVALUE(a) ((a < 0) ? 0 : ((a > 65536) ? 65535 : a))
-
- friendColor.red = BOUNDVALUE(redDelta);
- friendColor.green = BOUNDVALUE(greenDelta);
- friendColor.blue = BOUNDVALUE(blueDelta);
-
- colorB = Color2Index(&friendColor);
- Index2Color(colorB, &friendColor);
-
- friendColor.red = (friendColor.red + (long)tempColor.red) >> 1;
- friendColor.green = (friendColor.green + (long)tempColor.green) >> 1;
- friendColor.blue = (friendColor.blue + (long)tempColor.blue) >> 1;
-
- redDelta = tempColor.red - (long)friendColor.red;
- greenDelta = tempColor.green - (long)friendColor.green;
- blueDelta = tempColor.blue - (long)friendColor.blue;
-
- twoErr = FDistanceOverEstimate(redDelta, greenDelta, blueDelta);
-
- if(twoErr > oneErr)
- { colorB = colorA;
- }
- }
- else
- { colorB = colorA;
- }
-
- // Form a pattern using the two pixels:
- *dest++ = colorA; *dest++ = colorB; *dest++ = colorA; *dest++ = colorB;
- *dest++ = colorB; *dest++ = colorA; *dest++ = colorB; *dest++ = colorA;
-
- }
-
- HUnlock(destTable);
- SetGDevice(savedGD);
- SetPort(saved);
- }
-
-
- --
- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap.
- http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind.
-
- +++++++++++++++++++++++++++
-
- >From jmunkki@beta.hut.fi (Juri Munkki)
- Date: 3 Jan 1996 03:22:03 GMT
- Organization: Helsinki University of Technology
-
- I ran an exhaustive test of my two-color version of MakeRGBPat using the
- default system palette and default inverse tables and color matching.
-
- Apple says that MakeRGBPat will get you 2197 colors using a four color
- 2x2 pattern.
-
- I'm using a two color 2x2 pattern. I thought I would only get a few
- hundred colors or so using my own method, but guess what? I get 2505
- unique color matches.
-
- Inside Mac admits that the algorithm is optimized for speed rather than
- quality, but I still say they are doing a bad job in 8 bit color.
-
- I also went for the simplest approach I could think of. It takes an
- average of 64 microseconds to make one pattern on a Quadra 700, which
- means that the entire 24 bit color space was matched in 18 minutes.
-
- --
- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap.
- http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind.
-
- +++++++++++++++++++++++++++
-
- >From ckt@best.com (Chris Thomas)
- Date: Fri, 05 Jan 1996 21:13:14 -0800
- Organization: Echo Software
-
- In article <4ccsor$ofe@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote:
-
- > I ran an exhaustive test of my two-color version of MakeRGBPat using the
- > default system palette and default inverse tables and color matching.
- >
- > Apple says that MakeRGBPat will get you 2197 colors using a four color
- > 2x2 pattern.
- >
- > I'm using a two color 2x2 pattern. I thought I would only get a few
- > hundred colors or so using my own method, but guess what? I get 2505
- > unique color matches.
- >
- > Inside Mac admits that the algorithm is optimized for speed rather than
- > quality, but I still say they are doing a bad job in 8 bit color.
- >
- > I also went for the simplest approach I could think of. It takes an
- > average of 64 microseconds to make one pattern on a Quadra 700, which
- > means that the entire 24 bit color space was matched in 18 minutes.
-
- Curious, how does MakeRGBPat compare to that time?
-
- --
- Chris Thomas, ckt@best.com
-
- +++++++++++++++++++++++++++
-
- >From jmunkki@beta.hut.fi (Juri Munkki)
- Date: 6 Jan 1996 07:17:20 GMT
- Organization: Helsinki University of Technology
-
- In article <ckt-0501962113140001@ckt.vip.best.com> ckt@best.com (Chris Thomas) writes:
- >Curious, how does MakeRGBPat compare to that time?
-
- It's difficult to say, because MakeRGBPat works by setting up a color
- pattern without actually doing the color lookups. So the actual time
- spent in MakeRGBPat is probably short.
-
- Then, when you start drawing, QuickDraw looks up the colors. Since
- there are up to four colors, it probably calls Color2Index at least
- twice and most likely four times (I haven't checked).
-
- If your drawing spans several displays with different color tables,
- I assume QD has to redo the mapping each time for each different
- device, since it only stores one pattern at a time.
-
- So, the advantage of MakeRGBpat seems to be that it automatically
- adjusts to changing screen depths and color tables.
-
- My code is used when the cached patterns cdSeed doesn't match the
- device ctSeed. I keep the patterns for each device separetely, so
- multiple devices do not cause any overhead in this respect.
-
- Has anyone tried MakeRGBPat with 24 bit and 15 bit color? If it works
- the way I suspect it might, you would still get patterns. (It's easy
- enough to try...I should probably take five minutes some day and check
- what happens.)
-
- I guess the whole point is that they (Apple) didn't want to add special
- case code to QuickDraw pattern drawing routines to handle RGBPats and
- yet they wanted RGBPats to be independent of the device color map.
-
- I'm feeling a bit fuzzy today, so I'm not sure if this makes sense
- to anyone. Sorry.
-
- --
- Juri Munkki jmunkki@iki.fi Life is easy when polygons are cheap.
- http://www.iki.fi/~jmunkki Windsurfing: Faster than the wind.
-
- +++++++++++++++++++++++++++
-
- >From jinjur@kudonet.com (john calhoun)
- Date: 9 Jan 1996 04:49:01 GMT
- Organization: Scheherazade Software
-
- In article <4cl7m0$bcr@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote:
-
- > Has anyone tried MakeRGBPat with 24 bit and 15 bit color? If it works
- > the way I suspect it might, you would still get patterns.
-
- I have, and my experience with it is that you don't in fact get patterns,
- but rather get your RGBColor (if it is a "pattern", it is a SOLID pattern
- anyway). So it does the right thing on direct devices.
-
- john calhoun-
-
- +++++++++++++++++++++++++++
-
- >From tobyt@netspace.net.au (Toby Thain)
- Date: Wed, 10 Jan 1996 22:15:04 +1000
- Organization: NetSpace Online Systems
-
- In article <jinjur-0801962046540001@165.227.52.125>, jinjur@kudonet.com
- (john calhoun) wrote:
-
- > In article <4cl7m0$bcr@nntp.hut.fi>, jmunkki@beta.hut.fi (Juri Munkki) wrote:
- >
- > So it does the right thing on direct devices.
-
- Well, not really the right thing if the idea is to get the closest
- approximation to the target colour (which could easily be a combination of
- direct colour values, since the target is specified with 16 bits per
- channel).
-
-
- ---------------------------
-
- >From DaveZ@mailbag.com (David B. Zwiefelhofer)
- Subject: MoveControl Doesn't Change Dialog Item Rect
- Date: Wed, 10 Jan 1996 10:02:47 -0500
- Organization: Utility Reduction Specialists, Inc.
-
- I have a movable modal dialog with controls (check boxes implemented with
- control resources) that I need to move around. Unfortunately, moving them
- via MoveControl only moves the control's contrlRect and not the item's
- rect. Therefore, calls such as DialogSelect don't work.
-
- Does anyone know how to move a dialog item's rect? Obviously it can be
- done as AppendDITL does this. How can I?
-
- Thanks,
-
- Dave
-
- --
- David B. Zwiefelhofer
- Utility Reduction Specialists, Inc.
- 1605 Monroe Street, Suite 110
- Madison, WI 53211-2052
- (608) 258-8965
- (608) 258-9686 FAX
-
- +++++++++++++++++++++++++++
-
- >From DaveZ@mailbag.com (David B. Zwiefelhofer)
- Date: Thu, 11 Jan 1996 16:58:49 -0500
- Organization: Utility Reduction Specialists, Inc.
-
- In article <francois-regis.degott-1101961100520001@harpie.imag.fr>,
- francois-regis.degott@imag.fr (Fr. Degott) wrote:
-
- > Hi Dave,
- > i remember this question was asked before…
- > From memory, you should use GetDItem() balanced with
- > a SetDItem() call to change the item rect.
- >
- > something like this:
- >
- > GetDItem(dlog,item,&iType,&iHandle,&iRect);
- > SetRect(&newRect,blah,blah,blah,blah);
- > SetDItem(dlog,item,iType,iHandle,newRect);
- >
-
- Thanks. I guess I had one of those "where are my glasses?!" kind of
- things. There they were, on top of my head the whole time!
-
- -Dave
-
- --
- David B. Zwiefelhofer
- Utility Reduction Specialists, Inc.
- 1605 Monroe Street, Suite 110
- Madison, WI 53211-2052
- (608) 258-8965
- (608) 258-9686 FAX
-
- +++++++++++++++++++++++++++
-
- >From rickgenter@aol.com (RickGenter)
- Date: 12 Jan 1996 05:18:27 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- >>>
- Does anyone know how to move a dialog item's rect? Obviously it can be
- done as AppendDITL does this. How can I?
- <<<
-
- Call GetDialogItem (GetDItem using the old routine names), which returns
- the dialog item rectangle, type and handle, change the rectangle, then
- call SetDialogItem (SetDItem) to pass the change to the Dialog Manager.
-
- Rick Genter
- Papyrus Design Group, Inc.
-
- ---------------------------
-
- >From jhg@kepler.unh.edu (Jeff Gunn)
- Subject: Newbie help with events....
- Date: 9 Jan 1996 21:52:42 GMT
- Organization: University of New Hampshire
-
- Okay - I'm very familiar with programming in C and C++, but I'm
- just starting out with mac programming. I'm using CodeWarrior. I've
- succeeded in producing a window and displaying it, and having it disappear
- as soon as the mouse button is pressed. I want something more useful.
- I want to implement the close box, so the window stays open until I click
- the close box. I think I need to use "WaitNextEvent", but I'm not sure.
- Anyone with advice or a little code snippet? Thanks...
-
- -Jeff Gunn (jeff.gunn@unh.edu)
-
- --
- Jeffrey Gunn | Senior Consultant
- Jeff.Gunn@unh.edu | Computing and Information Services
- ---- | University of New Hampshire
- "Saying Windows 95 is equal to Macintosh is like finding a potato
- that looks like Jesus and believing you've witnessed the second coming."
- -Guy Kawasaki
-
-
- +++++++++++++++++++++++++++
-
- >From kenlong@netcom.com (Ken Long)
- Date: Wed, 10 Jan 1996 03:11:29 GMT
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
-
- Jeff Gunn (jhg@kepler.unh.edu) wrote:
- : Okay - I'm very familiar with programming in C and C++, but I'm
- : just starting out with mac programming. I'm using CodeWarrior. I've
- : succeeded in producing a window and displaying it, and having it disappear
- : as soon as the mouse button is pressed. I want something more useful.
- : I want to implement the close box, so the window stays open until I click
- : the close box. I think I need to use "WaitNextEvent", but I'm not sure.
-
- There are several "snippets" on your CW CD. "SillyBalls" exits on
- mouseDown, but some of the other examples don't. Find one that doesn't
- (has close box) and compare the differences to the main loop in that one
- to the main loop in yours.
-
- The should be some third party example sources on that CD as well.
-
- -Ken-
-
- +++++++++++++++++++++++++++
-
- >From schmeul@umich.edu (Sam Huffman)
- Date: Thu, 11 Jan 1996 22:14:13 -0500
- Organization: University of Michigan
-
- In article <4cuo3a$juq@mozz.unh.edu>, jhg@kepler.unh.edu (Jeff Gunn) wrote:
-
- > Okay - I'm very familiar with programming in C and C++, but I'm
- > just starting out with mac programming. I'm using CodeWarrior. I've
- > succeeded in producing a window and displaying it, and having it disappear
- > as soon as the mouse button is pressed. I want something more useful.
- > I want to implement the close box, so the window stays open until I click
- > the close box. I think I need to use "WaitNextEvent", but I'm not sure.
- > Anyone with advice or a little code snippet? Thanks...
- >
- > -Jeff Gunn (jeff.gunn@unh.edu)
-
- Well here's a simple example. Sorry it's not terribly complete - just
- grabbed it out of a program I happened to have open. You'll need to write
- the code for most of the functions. Actually you can just comment out most
- of what you're not using. For good examples check sumex-aim
- (ftp://mirrors.aol.com/pub/info-mac/ or something like that) in the
- development/source directory.
-
- Boolean gDone = false;
-
- void main(void)
- {
- InitMacintosh();
-
- while (!gDone) EventLoop();
- QuitProgram();
- }
-
- void EventLoop(void)
- {
- EventRecord theEvent;
- OSErr iErr;
-
- if (WaitNextEvent(everyEvent, &theEvent, 0xFFFFFFFF, NULL)) {
- switch(theEvent.what) {
- case mouseDown:
- HandleMouseDown(&theEvent);
- break;
-
- case kHighLevelEvent:
- iErr = AEProcessAppleEvent(&theEvent);
- break;
-
- case keyDown:
- case autoKey:
- if ((theEvent.modifiers & cmdKey) != 0)
- HandleMenuChoice(MenuKey(theEvent.message & charCodeMask));
- else HandleKey(theEvent.message & charCodeMask);
- break;
-
- case updateEvt:
- HandleUpdate((WindowPtr)theEvent.message);
- break;
-
- case activateEvt:
- HandleActivate(&theEvent);
- break;
-
- default:
- HandleNull();
- break;
- }
- }
- }
-
- void HandleMouseDown(EventRecord *theEvent)
- {
- WindowPtr theWindow;
- short thePart;
- long menuChoice;
-
- thePart = FindWindow(theEvent->where, &theWindow);
- switch(thePart) {
- case inMenuBar:
- menuChoice = MenuSelect(theEvent->where);
- HandleMenuChoice(menuChoice);
- break;
-
- case inSysWindow:
- SystemClick(theEvent, theWindow);
- break;
-
- case inDrag:
- DragWindow(theWindow, theEvent->where, &qd.screenBits.bounds);
- break;
-
- case inContent:
- if (theWindow == FrontWindow()) HandleClick(theWindow, theEvent);
- else SelectWindow(theWindow);
- break;
-
- case inGoAway:
- if (TrackGoAway(theWindow, theEvent->where) == true) {
- CloseMyWindow(theWindow);
- }
- break;
- }
- }
-
- ---------------------------
-
- >From david@interport.net (David)
- Subject: Oh where has my CODE 0 gone?
- Date: 6 Jan 1996 17:19:54 -0500
- Organization: Interport Communications Corp.
-
- I've noticed that CODE 0 never seems to be present in an application's
- heap. (Is this in fact universally true?) I've tried making it protected,
- preloading, and locked in Resedit, but it still doesn't show up. Where
- does this elusive little resource go when it's loaded? How do you
- find it in Macsbug? (I'm specifically trying to view the CODE 0 of
- an application while it's running.) Thanks for any suggestions!
-
- Dave :)
-
- +++++++++++++++++++++++++++
-
- >From Matt Slot <fprefect@umich.edu>
- Date: 7 Jan 1996 23:28:56 GMT
- Organization: University of Michigan
-
- David, david@interport.net writes:
- > I've noticed that CODE 0 never seems to be present in an application's
- > heap. (Is this in fact universally true?) I've tried making it protected,
- > preloading, and locked in Resedit, but it still doesn't show up. Where
- > does this elusive little resource go when it's loaded? How do you
- > find it in Macsbug? (I'm specifically trying to view the CODE 0 of
- > an application while it's running.) Thanks for any suggestions!
-
- CODE 0 is the Jump Table, and gets loaded just above A5 (app globals
- reside below A5), and stays resident throughout the applications
- execution. Remember that all other CODE resources may be loaded or
- unloaded at any time (well, not the currently executing one), since
- the Jump Table entry actually loads the resource on demand.
-
- Check out the Segment Loader chapter in NIM:Processes for more
- information.
-
- Matt
-
- * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
- * Reality: Matt Slot * Time is an illusion.
- * E-Mail: mailto:fprefect@umich.edu * Lunchtime doubly so.
- * Web: http://www.sils.umich.edu/~fprefect/ * -- Douglas Adams
- * * * * * * * * * * * * * * * * * * * * * * * * * * ======================
-
- +++++++++++++++++++++++++++
-
- >From Patrick.Stadelmann@etudiants.unine.ch (Patrick Stadelmann)
- Date: Mon, 08 Jan 1996 10:15:27 +0100
- Organization: University of Neuchatel
-
- In article <4cmsia$alm@interport.net>, david@interport.net (David) wrote:
-
- > I've noticed that CODE 0 never seems to be present in an application's
- > heap. (Is this in fact universally true?) I've tried making it protected,
- > preloading, and locked in Resedit, but it still doesn't show up. Where
- > does this elusive little resource go when it's loaded? How do you
- > find it in Macsbug? (I'm specifically trying to view the CODE 0 of
- > an application while it's running.) Thanks for any suggestions!
-
- The CODE 0 is the jump table. You can display it in MacsBug by
- typing "jumptable" (or something like that). I believe that the
- content of the resource is copied in the correct memory location
- (at a5+$20), then the resource is released.
-
- Patrick
-
- --
- Patrick Stadelmann <Patrick.Stadelmann@etudiants.unine.ch>
-
- +++++++++++++++++++++++++++
-
- >From CatGuy@lamg.com (Milo Shiff)
- Date: 09 Jan 1996 02:55:29 GMT
- Organization: Los Angeles Macintosh Group BBS
-
- In message ID <4cmsia$alm@interport.net> on 1/6/96, David wrote:
-
- D> I've noticed that CODE 0 never seems to be present in an application's
- D> heap. (Is this in fact universally true?) I've tried making it protected,
- D> preloading, and locked in Resedit, but it still doesn't show up. Where
- D> does this elusive little resource go when it's loaded? How do you
- D> find it in Macsbug? (I'm specifically trying to view the CODE 0 of
- D> an application while it's running.) Thanks for any suggestions!
-
- CODE zero exists as information for the OS in setting up the application
- heap and the A5 relative items.
-
- - via BulkRate 2.1
-
- +++++++++++++++++++++++++++
-
- >From CatGuy@lamg.com (Milo Shiff)
- Date: 10 Jan 1996 03:08:22 GMT
- Organization: Los Angeles Macintosh Group BBS
-
- Matt Slot,fprefect@umich.edu,Internet SAID:
-
- <<<Remember that all other CODE resources may be loaded or
- unloaded at any time (well, not the currently executing one)>>>
-
- Well, actually you CAN unload the currently executing CODE segment -- a
- mistake I made in a program a few years back, with predictably adverse
- results....
-
-
- ---------------------------
-
- >From wrrj@pobox.com (William Rose)
- Subject: The Required Apple Events (i.e. are they)
- Date: Tue, 09 Jan 1996 18:48:07 +1100
- Organization: W.R.R.J. Incorporated
-
- I have not done much programming with apple events yet, but I know that
- good people implement handlers for four of them, (from memory) 'oapp',
- 'odoc', 'pdoc' and 'quit'. I understand the purpose of the quit event.
- Question 1:
- i) Given the above, in an application that creates no files is it
- necessary to implement 'odoc' & 'pdoc'?
- ii) In an application that doesn't support printing, is it necessary to
- support 'pdoc'?
- Question 2:
- What on earth is the point of the 'oapp' event? I figure, you're
- program opens (from finder, LaunchApplication call or something). For C
- programmers, main is entered and things start rolling. You do your
- initialisation, set up apple event handlers, etc and then go into the
- major event loop. Why do you need a separate event to tell you 'in case
- you hadn't noticed, you were just opened.'? It shouldn't be to do
- activate/deactivate stuff, there are perfectly good event manager events
- for that. Please, somebody, why?
-
- Thanks for reading,
- William Rose
-
- +++++++++++++++++++++++++++
-
- >From Carl R. Osterwald <carl_osterwald@nrel.gov>
- Date: 9 Jan 1996 16:31:49 GMT
- Organization: National Renewable Energy Laboratory
-
- In article <wrrj-0901961848070001@slmel1p50.ozemail.com.au> William
- Rose, wrrj@pobox.com writes:
-
- > I have not done much programming with apple events yet, but I know that
- >good people implement handlers for four of them, (from memory) 'oapp',
- >'odoc', 'pdoc' and 'quit'. I understand the purpose of the quit event.
- > Question 1:
- > i) Given the above, in an application that creates no files is it
- >necessary to implement 'odoc' & 'pdoc'?
-
- Does the app open files? If so, you will need to handle the odoc event.
-
- > ii) In an application that doesn't support printing, is it necessary to
- >support 'pdoc'?
-
- If this is just a quick program for testing something that will never
- see the light of day, you can certainly get by without them. But real
- applications should because if they aren't there, the Finder goes
- through some machinations to simulate them. Also, they are really easy
- to implement, even if they are never called. I just do something like
- this (the handler has to installed, of course):
-
- static pascal OSErr handle_pdoc_apple_event
- (AppleEvent *message, AppleEvent *reply, long refcon)
- {
- return( all_required_params_extracted(message) );
- } // handle_pdoc_apple_event
-
- OSErr all_required_params_extracted (AppleEvent *message)
- {
- OSErr result;
- DescType returned_type;
- Size actual_size;
-
- result = AEGetAttributePtr
- (message, keyMissedKeywordAttr, typeWildCard,
- &returned_type, nil, 0, &actual_size);
- switch (result)
- {
- case errAEDescNotFound:
- return(noErr);
- case noErr:
- return(errAEEventNotHandled);
- default:
- return(result);
- }
- } // all_required_params_extracted
-
- > Question 2:
- > What on earth is the point of the 'oapp' event? I figure, you're
- >program opens (from finder, LaunchApplication call or something).
-
- The oapp is how the Finder tells your application how it was opened. If
- a file belonging to your app was double-clicked (or opened from the File
- menu in the Finder), the app receives an odoc event. If the application
- itself was opened without a file, the Finder sends an oapp event.
-
- Hope this helps.
-
- +++++++++++++++++++++++++++
-
- >From "Andrew C. Plotkin" <erkyrath+@CMU.EDU>
- Date: Tue, 9 Jan 1996 12:14:23 -0500
- Organization: Carnegie Mellon, Pittsburgh, PA
-
- wrrj@pobox.com (William Rose) writes:
- > I have not done much programming with apple events yet, but I know that
- > good people implement handlers for four of them, (from memory) 'oapp',
- > 'odoc', 'pdoc' and 'quit'. I understand the purpose of the quit event.
- > Question 1:
- > i) Given the above, in an application that creates no files is it
- > necessary to implement 'odoc' & 'pdoc'?
-
- You should probably install handlers for them, but it's ok if the
- handlers do nothing.
-
- > ii) In an application that doesn't support printing, is it necessary to
- > support 'pdoc'?
-
- Yes. You should at least have a handler which puts up a dialog which
- reads "TwiddleStar documents cannot be printed. Sorry."
-
- > Question 2:
- > What on earth is the point of the 'oapp' event?
-
- The OApp event is *only* received when your application is run by
- itself. You do *not* get an OApp if your application is launched
- because someone double-clicked (or printed) a document.
-
- The typical thing to do when you get OApp is create an empty document
- called "Untitled".
-
- --Z
-
- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
-
- +++++++++++++++++++++++++++
-
- >From isis@netcom.com (Mike Cohen)
- Date: Tue, 09 Jan 1996 10:32:13 -0600
- Organization: ISIS International
-
- In article <wrrj-0901961848070001@slmel1p50.ozemail.com.au>,
- wrrj@pobox.com (William Rose) wrote:
-
- > I have not done much programming with apple events yet, but I know that
- >good people implement handlers for four of them, (from memory) 'oapp',
- >'odoc', 'pdoc' and 'quit'. I understand the purpose of the quit event.
- > Question 1:
- > i) Given the above, in an application that creates no files is it
- >necessary to implement 'odoc' & 'pdoc'?
- > ii) In an application that doesn't support printing, is it necessary to
- >support 'pdoc'?
-
- In those cases, it's OK not to handle those events.
-
- > Question 2:
- > What on earth is the point of the 'oapp' event? I figure, you're
- >program opens (from finder, LaunchApplication call or something). For C
- >programmers, main is entered and things start rolling. You do your
- >initialisation, set up apple event handlers, etc and then go into the
- >major event loop. Why do you need a separate event to tell you 'in case
- >you hadn't noticed, you were just opened.'? It shouldn't be to do
- >activate/deactivate stuff, there are perfectly good event manager events
- >for that. Please, somebody, why?
- >
-
- 'oapp' is sent when your application is double-clicked without a document
- (as opposed to 'odoc', which is sent when a document is double-clicked). In
- most cases, you should do the appropriate thing for that case, such as
- opening a new untitled document.
-
-
- --
- Mike Cohen - isis@isis-intl.com
- Home Page: http://www.isis-intl.com/
- Sound is the same for all the world - Youssou N'dour, "Eyes Open"
- *** Save Mystery Science Theater 3000! Comedy Central has decided to
- *** cancel it. Call them at (212) 767-8600 and tell them what you think.
- *** Full details at http://fermi.clas.virginia.edu/~jcp9j/canceled.html
-
- +++++++++++++++++++++++++++
-
- >From deslee@bright.net (Des Courtney)
- Date: Tue, 09 Jan 1996 23:51:58 -0500
- Organization: Flair Diversions
-
- In article <wrrj-0901961848070001@slmel1p50.ozemail.com.au>,
- wrrj@pobox.com (William Rose) wrote:
-
- ) Question 2:
- ) What on earth is the point of the 'oapp' event?
- [snip]
-
- One reason "Open Application" exists is as a way to determine if the
- application was opened directly or via opening a document. "odoc"
- events are sent before the "oapp" event if the program is launched
- with documents. You can then use the "odoc" handler to cause
- different actions to occur based on this.
-
- A common trick for "drag-on" and "helper" apps is to keep the
- program running after a direct launch, but to auto-quit when
- opening documents are manipulated. In this case, the "oapp"
- handler would send a "quit" event if it detected that a "odoc"
- event was received first.
-
- Hope this makes sense,
-
- Des Courtney
-
- --
- Flair Diversions is... Des Courtney, writer of cool Mac software
- Outpost Nexus, Ambiance, Icons for MICN, etc.
- mailto:deslee@bright.net
- Obligatory ASCII graphic --> (-;
-
- +++++++++++++++++++++++++++
-
- >From deirdre@sover.net (Deirdre)
- Date: Wed, 10 Jan 1996 10:24:00 -0500
- Organization: Hah!
-
- I always support all four required events even in teensy little
- applications that have no documents. I just make 'odoc' and 'pdoc' an
- empty function.
-
- For the oapp event, you may want to do some specific initialization. Other
- than that, I don't "get" why it's there either. I just make that an empty
- function too. It is in theory possible that you wil get this event after
- your app has been running for some time.
-
- I suspect that the 'oapp' event may be for future compatibility, which is
- why I always support it.
-
- _Deirdre
-
- In article <wrrj-0901961848070001@slmel1p50.ozemail.com.au>,
- wrrj@pobox.com (William Rose) wrote:
-
- > I have not done much programming with apple events yet, but I know that
- > good people implement handlers for four of them, (from memory) 'oapp',
- > 'odoc', 'pdoc' and 'quit'. I understand the purpose of the quit event.
- > Question 1:
- > i) Given the above, in an application that creates no files is it
- > necessary to implement 'odoc' & 'pdoc'?
- > ii) In an application that doesn't support printing, is it necessary to
- > support 'pdoc'?
- > Question 2:
- > What on earth is the point of the 'oapp' event? I figure, you're
- > program opens (from finder, LaunchApplication call or something). For C
- > programmers, main is entered and things start rolling. You do your
- > initialisation, set up apple event handlers, etc and then go into the
- > major event loop. Why do you need a separate event to tell you 'in case
- > you hadn't noticed, you were just opened.'? It shouldn't be to do
- > activate/deactivate stuff, there are perfectly good event manager events
- > for that. Please, somebody, why?
-
- +++++++++++++++++++++++++++
-
- >From 75103.761@compuserve.com (Jeffrey Kraus)
- Date: Fri, 12 Jan 1996 22:55:12 -0800
- Organization: Berbee Information Networks Corporation
-
- In article <deirdre-1001961024000001@pm0a24.bf.sover.net>,
- deirdre@sover.net (Deirdre) wrote:
-
- > I always support all four required events even in teensy little
- > applications that have no documents. I just make 'odoc' and 'pdoc' an
- > empty function.
- >
- > For the oapp event, you may want to do some specific initialization. Other
- > than that, I don't "get" why it's there either. I just make that an empty
- > function too. It is in theory possible that you wil get this event after
- > your app has been running for some time.
- >
- > I suspect that the 'oapp' event may be for future compatibility, which is
- > why I always support it.
- >
-
- I have my program use the 'oapp' to check it's preference file and open
- the last file that was opened. If the program receives an 'odoc' it opens
- the specified file.
-
- I do this since my program only views documents and does not create them
- and is only usefull when a document is open.
-
- +++++++++++++++++++++++++++
-
- >From dnebing@epix.net (Dave Nebinger)
- Date: Mon, 15 Jan 1996 14:21:51 -0500
- Organization: KHP Services, Inc
-
- In article <75103.761-1201962255120001@msn_3_1.binc.net>,
- 75103.761@compuserve.com (Jeffrey Kraus) wrote:
-
- > In article <deirdre-1001961024000001@pm0a24.bf.sover.net>,
- > deirdre@sover.net (Deirdre) wrote:
- >
- > > I always support all four required events even in teensy little
- > > applications that have no documents. I just make 'odoc' and 'pdoc' an
- > > empty function.
- > >
-
- If an app doesn't support printing, shouldn't you *not* include a pdoc handler
- to have the apple event manager return the errAEEventNotHandled error? Why
- make a script or AE-aware application think that you successfully handled
- an event that you don't or can't handle?
-
- > > For the oapp event, you may want to do some specific initialization. Other
- > > than that, I don't "get" why it's there either. I just make that an empty
- > > function too. It is in theory possible that you wil get this event after
- > > your app has been running for some time.
- > >
- > > I suspect that the 'oapp' event may be for future compatibility, which is
- > > why I always support it.
- > >
- >
- > I have my program use the 'oapp' to check it's preference file and open
- > the last file that was opened. If the program receives an 'odoc' it opens
- > the specified file.
-
- The IM:IAC says that 'oapp's should do what a non-AE aware app would do
- when it starts up (i.e. open a new document window if a text editor, etc.).
-
- A recent addition to the registry for the AppleScript suite is a 'No Operation'
- event which should do nothing on application launch. From the AppleScript
- Suite document:
-
- "The No Operation event can be used as an alternative to the standard launch
- events sent by the Finder: Open Application, Open Documents, and Print
- Documents. It indicates that the application is being launched by a script,
- which will subsequently send more events. There are two reasons for the
- No Operation event: 1> From a scripting point of view, most applications perform
- undesireable actions when they receive the standard Open Application event. For
- example, they open a new document, or display a modal dialog waiting for
- user response. 2) The event an application is launched with cannoth have a
- reply, thus no erros are returned to the script. No Operation event, when used
- for launching, will avoid the standard double-click behavior, and allow
- subsequent events to return error replies."
-
- Dave.
-
- ==========================================================
- Dave Nebinger dnebing@epix.net
- The Alt.Sources.Mac Archivist
-
- +++++++++++++++++++++++++++
-
- >From clw95002@uconnvm.uconn.edu (Chris Waskowich)
- Date: 12 Jan 1996 16:14:22 GMT
- Organization: University of Connecticut
-
- In article <wrrj-0901961848070001@slmel1p50.ozemail.com.au>,
- wrrj@pobox.com (William Rose) wrote:
-
- > Question 2:
- > What on earth is the point of the 'oapp' event?
-
-
-
- I have an app that I wrote, this is what happens:
-
- case 1: If I double click the app, it opens with the standard open
- dialog. I do this thorugh 'oapp'.
-
- case 2: I drop a file on my app, but I really don't feel like getting the
- standard open dialog box, so it just opens the file instead.
-
-
- Other than that I have no clue what else you wuld use it for...
-
-
-
- Chris Waskowich
-
-
- ---------------------------
-
- >From grinch@ns.moran.com (The Grinch)
- Subject: Turning on Sharing
- Date: Fri, 05 Jan 1996 17:59:10 -0500
- Organization: Vortex Software
-
- I am writing a big old installer and a half. It runs local on each
- computer in a lab, logs onto a central server or two, and basically copies
- most of the server's HD. In this way we can set up the lab unattended over
- night.
-
- MY PROBLEM IS THIS:
- I'd like to be able to automate the setting of access privs and the
- configuring of share points (shared directories). However, it seems (by
- the errors I get) that I'm not allowed to establish share points when file
- sharing is off. So how do I turn the silly thing on? Vinfo? PRAM? I'd
- really be grateful for some code, but please drop me a line if you just
- know where the info is stored.
- Also, if anybody has a chunk of code to copy access privs from one
- folder to another, please post it! It would save me quite a bit of work.
-
- Please e-mail your replies. And thanx for the help!
-
- -The Grinch
-
- +++++++++++++++++++++++++++
-
- >From zobkiw@triplesoft.com (Joe Zobkiw)
- Date: Sun, 07 Jan 1996 08:53:16 -0500
- Organization: TripleSoft Inc.
-
- In article <grinch-0501961759100001@nw53.moran.com>, grinch@ns.moran.com
- (The Grinch) wrote:
-
- >I am writing a big old installer and a half. It runs local on each
- >computer in a lab, logs onto a central server or two, and basically copies
- >most of the server's HD. In this way we can set up the lab unattended over
- >night.
-
- I presume you've looked at the programs that exist to do this already.
- Just in case one of them works for you, you wouldn't have to re-invent the
- wheel.
-
- >MY PROBLEM IS THIS:
- > I'd like to be able to automate the setting of access privs and the
- >configuring of share points (shared directories). However, it seems (by
- >the errors I get) that I'm not allowed to establish share points when file
- >sharing is off. So how do I turn the silly thing on? Vinfo? PRAM? I'd
- >really be grateful for some code, but please drop me a line if you just
- >know where the info is stored.
-
- You simply launch the File Sharing faceless-background-application using
- LaunchApplication(...). That is how you start it. To quit it, simply send
- it a 'quit' AppleEvent.
-
- > Also, if anybody has a chunk of code to copy access privs from one
- >folder to another, please post it! It would save me quite a bit of work.
-
- Look for MoreFiles (1.4 is the latest)...you can get it from here
- <ftp://users.aol.com/jumplong/MoreFiles_1.4.sea.bin>
-
- Good luck!
-
- Joe Zobkiw <mailto:zobkiw@triplesoft.com>
- TripleSoft Inc. <http://www.triplesoft.com/>
- Specializing in Custom Macintosh Software Development & Solutions
- - ---------------------------------------------------------------
- Macintosh programmers! Check out "A Fragment of Your Imagination"
- from Addison-Wesley <http://www.triplesoft.com/fragment/>
-
- +++++++++++++++++++++++++++
-
- >From jumplong@aol.com (Jump Long)
- Date: 7 Jan 1996 14:54:35 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- Joe Zobkiw responded to The Grinch with:
- >>MY PROBLEM IS THIS:
- >> I'd like to be able to automate the setting of access privs and the
- >>configuring of share points (shared directories). However, it seems (by
- >>the errors I get) that I'm not allowed to establish share points when
- file
- >>sharing is off. So how do I turn the silly thing on? Vinfo? PRAM? I'd
- >>really be grateful for some code, but please drop me a line if you just
- >>know where the info is stored.
- >
- >You simply launch the File Sharing faceless-background-application using
- >LaunchApplication(...). That is how you start it. To quit it, simply send
- >it a 'quit' AppleEvent.
-
- Really, you should use the Server Control call SCStartServer. Get the
- AppleShare API from Apple's Mac OS SDK CD-ROM - there's sample code with
- the SDK that shows how to do that.
-
- The source code for UnmountIt and Server Remote Control (two programs I
- wrote) also shows how to call SCStartServer. You can download the source
- code for UnmountIt at:
-
- ftp://sam.austin.apple.com/Apple.Support.Area/Developer_Services/Tool_Ches
- t/Files/UnmountIt_1.2.sit.hqx
-
- and Server Romote Control can be obtained from:
-
- ftp://sam.austin.apple.com/Apple.Support.Area/Developer_Services/Tool_Ches
- t/Interapplication_Communication/Server_Remote_Control_1.1/Server_Remote_Co
- ntrol_1.1.sit.hqx
-
- >> Also, if anybody has a chunk of code to copy access privs from one
- >>folder to another, please post it! It would save me quite a bit of work.
- >
- >Look for MoreFiles (1.4 is the latest)...you can get it from here
- ><ftp://users.aol.com/jumplong/MoreFiles_1.4.sea.bin>
-
- Actually, you'll want toget MoreFiles 1.4.1 which I released last night
- from:
-
- ftp://members.aol.com/JumpLong/MoreFiles 1.4.1.sea.hqx
-
- You can use the routine CopyDirectoryAccess to do that. The
- CopyDirectoryAccess function copies the AFP directory access privileges
- from one directory to another. Both directories *must* be on the same file
- server, but not necessarily on the same server volume. Why? Because if
- the volumes are on different servers, there's no way you can guarantee
- that the user on server "A" with the name "Jim Luther" is the same user as
- the user on server "B" named "Jim Luther", so I don't let you make that
- assumption with CopyDirectoryAccess.
-
- - Jim Luther
-
- ---------------------------
-
- >From jumplong@aol.com (Jump Long)
- Subject: [ANN] MoreFiles v1.4.1 now available
- Date: 7 Jan 1996 04:08:57 -0500
- Organization: America Online, Inc. (1-800-827-6364)
-
- [ANN] MoreFiles v1.4.1 now available
-
- Don't you hate it when you rush to beat a deadline and miss a couple of
- stupid bugs? I know I do because I have to release an update. In my case,
- I rushed MoreFiles 1.4 out the door to make it available before the
- holidays... and then started receiving bug reports.
-
- I've fixed all bugs reported (and rechecked my other 1.4 changes), so
- MoreFiles 1.4.1 is now available at:
-
- ftp://members.aol.com/JumpLong/MoreFiles 1.4.1.sea.hqx
-
- I've pasted the release notes for MoreFile 1.4.1 in case you're wondering
- what didn't work.
-
- Happy New Year!
-
- Jim Luther
- JumpLong@aol.com
- ________________________________________
-
- v1.4.1 1/6/96
-
- Bugs fixed:
- * Fixed the conditionalized code FSpCreateCompat.
- * Fixed the conditionalized code FSpExchangeFilesCompat.
- * Fixed the conditionalized code FSpCreateResFileCompat.
-
- Other changes:
- * Changed PBStatus(&pb, false) to PBStatusSync(&pb) in GetDiskBlocks.
-
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-
-
- Attachment converted: Webworm:BackgroundClicks.p (TEXT/PJMM) (0002639A)
-